#--------------------------------------------------------------------------------------------
# Name:        YearlyBuffer.py
# Purpose:     Creates Buffer zones for sugarcane fields in a list of given years.
#
# Author:      marcelo
#
# Created:     05/20/2014
# Copyright:   (c) marcelo 2015
# Licence:     <your licence>
#--------------------------------------------------------------------------------------------

# import system module
import arcpy
from arcpy import env

# First creates fishnet to split the Dissolved Canasat, then uses split to get
# more manageble features to buffer.

# Set workspace environment:
env.workspace = "C:\Users\Marcelo\Documents\Sugarcane\Offline Data\MunicBasedData\CanasatData.gdb"

# Buffer distance (in meters):
dist = 5000
# Years to buffer
Years = range(2009,2014)
# Base name of buffered feature
BaseName = "Canasat_CS_"
# New name:

for y in Years:
	BufferedFeat = BaseName + str(y)
	NewBuffer   = "BufCS" + str(dist/1000) + "km_" + str(y)
	# Buffer the buffer to increase speed in buffering:
	Buffer      = str(dist) + " Meters"
	arcpy.Buffer_analysis(BufferedFeat, NewBuffer, Buffer, "", "", "ALL", "")

